package com.weiyuwqj.server.mapper;

import com.weiyuwqj.api.model.BusAccountCash;
import com.weiyuwqj.api.model.vo.BusAccountCashVo;
import com.weiyuwqj.api.model.vo.FundData;
import com.weiyuwqj.api.model.vo.SumCashAccountVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Repository
public interface BusAccountCashMapper extends Mapper<BusAccountCash> {
	
	int updateAccountCashStatus(String orderNo, int oldStatus, int newStatus);
	
	BusAccountCash findBusAccountCashByOrderNo(String orderNo);
	
	List<BusAccountCash> findBusAccountCashByStatus(int status);

	List<BusAccountCash> findBusAccountCashByUserId(int userId);

	List<BusAccountCashVo> getList(Map<String, Object> param);

	BusAccountCashVo getSingle(Map<String, Object> param);

	//获取用户当日提现总金额
	Integer getTodayWithdrawTotal(Integer userId);

	//统计提现额度
	List<SumCashAccountVo> sumCashAccount();

	BigDecimal sumDaysCash(Map map);

	Integer getMonthlyWithdrawTotal(Map map);

	//后台首页提现金额统计
	Map countCashAmount();

	BigDecimal sumCashAmountByUserId(Integer userId);

	List<BusAccountCashVo> getListByUserId(Integer userId);

	List<BusAccountCashVo> getDailyList(Map<String, Object> map);

	//根据查询条件统计提现金额
	List<Map> statCashAmount(Map map);

	//后台首页提现趋势图
	List<Map> getRegionGroupCountCashList(Map map);

    int updateRemarkByOrderNo(@Param(value = "orderNo") String orderNo, @Param(value = "remark")String remark);

	//查询需对账的数据
    List<FundData> listFundData(Map map);

	//插入提现记录
    int insertCash(BusAccountCash accountCash);

	/**
	 * 根据时间，用户统计提现金额
	 * @param beginDate
	 * @param endDate
	 * @param userId
	 * @return
	 */
	BigDecimal sumCashAmountByDateAndUserId(@Param("beginDate")Date beginDate,@Param("endDate")Date endDate,@Param("userId")Integer userId);
}